package com.wd.mondle_home.model.adapter

import android.annotation.SuppressLint
import android.content.Context
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import com.bumptech.glide.Glide
import com.wd.current.model.Bean.DataBean
import com.wd.myhome.R
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder



//================================================查询全部礼物列表适配器
class FindAllGiftAdapter(context: Context?, layoutId: Int, datas: MutableList<DataBean.FindAllGiftBean.Result>?) : CommonAdapter<DataBean.FindAllGiftBean.Result>(context,
    layoutId, datas
) {
    var anInt:Int=0
    @SuppressLint("ResourceAsColor")
    override fun convert(holder: ViewHolder?, t: DataBean.FindAllGiftBean.Result, position: Int) {
        holder?.setText(R.id.name_gift_list,t.name)
        holder?.setText(R.id.money_gift_list_id,""+t.price+"V币")

        holder?.getView<ImageView>(R.id.pic_img_gift_list)?.let {
            Glide.with(mContext)
                .load(t.imageUrl)
                .into(it)

        }

        if (anInt==position){
            holder?.getView<ConstraintLayout>(R.id.gift_list_popup_background_id)?.setBackgroundColor(R.color.yes)
        }else{
            holder?.getView<ConstraintLayout>(R.id.gift_list_popup_background_id)?.setBackgroundColor(R.color.no)
        }
    }
}